package com.xykj.enterprise.wechat.ext.service.schedule;

import com.xykj.enterprise.wechat.bean.ext.BaseResp;
import com.xykj.enterprise.wechat.bean.ext.schedule.AddScheduleVo;
import com.xykj.enterprise.wechat.bean.ext.schedule.GetScheduleVo;
import com.xykj.enterprise.wechat.ext.service.QYWXHttpCommUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.HashMap;

@Service
@Slf4j
public class ScheduleServiceImpl implements ScheduleService {

    @Override
    public AddScheduleVo addSchedule(String accessToken, String json) {
        return QYWXHttpCommUtil.postWithAccessToken("oa/schedule/add", json, accessToken, AddScheduleVo.class);

    }

    @Override
    public BaseResp updateSchedule(String accessToken, String json) {
        return QYWXHttpCommUtil.postWithAccessToken("oa/schedule/update", json, accessToken, BaseResp.class);

    }

    @Override
    public GetScheduleVo getSchedule(String accessToken, HashMap<String, Object> params) {
        params.put("access_token", accessToken);
        return QYWXHttpCommUtil.postWithAccessToken("oa/schedule/get", params, GetScheduleVo.class);

    }

    @Override
    public BaseResp deleteSchedule(String accessToken, HashMap<String, Object> params) {
        params.put("access_token", accessToken);
        return QYWXHttpCommUtil.postWithAccessToken("oa/schedule/del", params, BaseResp.class);

    }

    @Override
    public GetScheduleVo getScheduleByCalendar(String accessToken, HashMap<String, Object> params) {
        params.put("access_token", accessToken);
        return QYWXHttpCommUtil.postWithAccessToken("oa/schedule/get_by_calendar", params, GetScheduleVo.class);

    }
}
